/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



Ext.onReady(function(){
    data = new Array(
        {id: 'eventtype1', type: 'hotel', img: './image/icons/hotel.gif'},
        {id: 'eventtype2', type: 'restaurant', img: './image/icons/restaurant.gif'},
        {id: 'eventtype3', type: 'visit', img:'./image/icons/visit.gif' },
        {id: 'eventtype4',type: 'direction', img: './image/icons/direction.gif' },
        {id: 'eventtype5', type: 'shopping', img: './image/icons/shopping.gif'},
        {id: 'eventtype6', type: 'entertainment', img: './image/icons/entertainment.gif'},
        {id: 'eventtype7', type: 'other', img: './image/icons/other.gif'},
        {id: 'eventtype8', type: 'note', img: './image/icons/note.gif'}
    );
    Ext.QuickTips.init();
    initializeMap();
    initializeDrag();
    loadPlan();
    //displayEvents();
});

function getImgFromDataByType(type) {
    var img;
    for(var j=0; j<data.length; j++) {
        if(type == data[j].type||j==data.length-1) {
            img = data[j].img;
            break;
        }
    }
    return img;
}

function getTypeAndImgFromDataById(id) {
    var typeAndImg;
    for(var j=0; j<data.length; j++) {
        if(id == data[j].id) {
            typeAndImg = {type:data[j].type, img: data[j].img};
            break;
        }
    }
    return typeAndImg;
}
